Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
Node JS loading secrets on a "pre" task and updating the environment variables for the main task

I have many services written in Node and loading secrets on startup has always been a problem for me.

I believe that when a service starts up, it should have every piece of configuration/secret ready for it beforehand.

  • Static configurations are easy (environment variables, usually via .env file).
  • Secrets? More complex if the infra hosting you doesn't support that.

Luckily, I've found that in Node, whatever script we add to the package.json file can have pre and/or post scripts as well. So it comes in very handy, as I can:

  1. have a reusable code that loaded secrets from somewhere
  2. persists the values in the environment variables
  3. before starting up the main script

The difficulty is that I'm unable to persist environment variables and have them available on the next process.

I wonder if that's a limitation (in Linux) or there's some way that I have missed.

Writing the secrets to a file to be read by the main process is unacceptable.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda